home *** CD-ROM | disk | FTP | other *** search
- Path: sun001.spd.dsccc.com!spd!jmccarty
- From: jmccarty@spd.dsccc.com (Mike McCarty)
- Newsgroups: comp.lang.c
- Subject: Re: MACROS with varying number of parameters
- Date: 16 Feb 1996 20:02:05 GMT
- Organization: DSC Communications Corporation, Plano, Texas USA
- Message-ID: <4g2nrt$l6h@sun001.spd.dsccc.com>
- References: <freedmanj-1502961337370001@155.95.68.41>
- NNTP-Posting-Host: aplo139.spd.dsccc.com
-
- In article <freedmanj-1502961337370001@155.95.68.41>,
- Jerry Freedman <freedmanj@mail.ndhm.gtegsc.com> wrote:
- )
- ) A while back I saw a trick for writing macros with a variable number of
- )paramters. Its very useful for debugging stuff like
- )
- )#ifdef
- )#define DEBUG_PRINT(some parameters) printf(parameters)
- )#else
- )#define DEBUG_PRINT(some_parameters)
- )#endif
- )
- ) Unfortunately, I lost it. I'd like to see it again,
- )
- )
- ) Thanks
- ) Jerry Freedman,Jr
-
-
- #ifdef DEBUGGING_ON
- #define DEBUG_PRINT(x) printf x
- #else
- #define DEBUG_PRINT(x)
- #endif
-
- DEBUG_PRINT(("This is a format string: %s\n",string));
-
- Mike
- ----
- char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
-
- I don't speak for DSC. <- They make me say that.
-